﻿using System;
using System.Data;
using System.IO;
using System.Xml;
using System.Configuration;
using System.ComponentModel;
using System.Collections.Generic;

namespace GreatB2C.Config.SiteInfo
{
    public class UserConfig
    {

        #region 用户参数设置
        /// <summary>
        /// 是否开启会员注册功能
        /// </summary>
        public static string EnableUserReg
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "EnableUserReg" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "EnableUserReg" , value );
            }
        }

        /// <summary>
        /// 会员注册服务条款和声明
        /// </summary>
        public static string Protocol
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "Protocol" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "Protocol" , value );
            }
        }

        /// <summary>
        /// 是否允许一个Email注册多个会员
        /// </summary>
        public static string EnableMultiRegPerEmail
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "EnableMultiRegPerEmail" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "EnableMultiRegPerEmail" , value );
            }
        }

        /// <summary>
        /// 新会员注册时用户名最少字符数
        /// </summary>
        public static string UserNameLimit
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "UserNameLimit" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "UserNameLimit" , value );
            }
        }

        /// <summary>
        /// 新会员注册时用户名最多字符数
        /// </summary>
        public static string UserNameMax
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "UserNameMax" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "UserNameMax" , value );
            }
        }

        /// <summary>
        /// 禁止注册的用户名
        /// </summary>
        public static string UserName_RegDisabled
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "UserName_RegDisabled" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "UserName_RegDisabled" , value );
            }
        }

        /// <summary>
        /// 会员注册时的必填项目
        /// </summary>
        public static string RegFields_MustFill
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "RegFields_MustFill" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "RegFields_MustFill" , value );
            }
        }

        /// <summary>
        /// 会员注册时的选填项目
        /// </summary>
        public static string RegFields_SelectFill
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "RegFields_SelectFill" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "RegFields_SelectFill" , value );
            }
        }

        /// <summary>
        /// 是否启用注册企业功能
        /// </summary>
        public static string EnableRegCompany
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "EnableRegCompany" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "EnableRegCompany" , value );
            }
        }

        /// <summary>
        /// 会员注册时是否启用验证码功能
        /// </summary>
        public static string EnableCheckCodeOfReg
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "EnableCheckCodeOfReg" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "EnableCheckCodeOfReg" , value );
            }
        }

        /// <summary>
        /// 会员注册时是否启用回答问题验证功能
        /// </summary>
        public static string EnableQAofReg
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "EnableQAofReg" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "EnableQAofReg" , value );
            }
        }

        /// <summary>
        /// 问题一
        /// </summary>
        public static string RegQuestion1
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "RegQuestion1" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "RegQuestion1" , value );
            }
        }

        /// <summary>
        /// 答案一
        /// </summary>
        public static string RegAnswer1
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "RegAnswer1" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "RegAnswer1" , value );
            }
        }

        /// <summary>
        /// 问题二
        /// </summary>
        public static string RegQuestion2
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "RegQuestion2" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "RegQuestion2" , value );
            }
        }

        /// <summary>
        /// 答案二
        /// </summary>
        public static string RegAnswer2
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "RegAnswer2" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "RegAnswer2" , value );
            }
        }

        /// <summary>
        /// 问题三
        /// </summary>
        public static string RegQuestion3
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "RegQuestion3" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "RegQuestion3" , value );
            }
        }

        /// <summary>
        /// 答案三
        /// </summary>
        public static string RegAnswer3
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "RegAnswer3" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "RegAnswer3" , value );
            }
        }

        /// <summary>
        /// 新会员注册是否需要管理员认证
        /// </summary>
        public static string AdminCheckReg
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "AdminCheckReg" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "AdminCheckReg" , value );
            }
        }

        /// <summary>
        /// 新会员注册是否需要邮件验证
        /// </summary>
        public static string EmailCheckReg
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "EmailCheckReg" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "EmailCheckReg" , value );
            }
        }

        /// <summary>
        /// 新会员注册时发送的验证邮件内容
        /// </summary>
        public static string EmailOfRegCheck
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "EmailOfRegCheck" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "EmailOfRegCheck" , value );
            }
        }

        /// <summary>
        /// 新会员注册成功后所属会员组
        /// </summary>
        public static string UserGroup
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "UserGroup" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "UserGroup" , value );
            }
        }

        /// <summary>
        /// 新会员注册时赠送的积分
        /// </summary>
        public static string PresentExp
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "PresentExp" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "PresentExp" , value );
            }
        }

        /// <summary>
        /// 新会员注册时赠送的金钱
        /// </summary>
        public static string PresentMoney
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "PresentMoney" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "PresentMoney" , value );
            }
        }

        /// <summary>
        /// 新会员注册时赠送的点券
        /// </summary>
        public static string PresentPoint
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "PresentPoint" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "PresentPoint" , value );
            }
        }

        /// <summary>
        /// 新会员注册时赠送的有效期
        /// </summary>
        public static string PresentValidNum
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "PresentValidNum" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "PresentValidNum" , value );
            }
        }

        /// <summary>
        /// 会员找回密码的方式
        /// </summary>
        public static string GetPasswordType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "GetPasswordType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "GetPasswordType" , value );
            }
        }

        /// <summary>
        /// 会员登录时是否启用验证码功能
        /// </summary>
        public static string EnableCheckCodeOfLogin
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "EnableCheckCodeOfLogin" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "EnableCheckCodeOfLogin" , value );
            }
        }

        /// <summary>
        /// 会员登录时是否允许多人同时使用同一会员帐号
        /// </summary>
        public static string EnableMultiLogin
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "EnableMultiLogin" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "EnableMultiLogin" , value );
            }
        }

        /// <summary>
        /// 会员每登录一次奖励的积分
        /// </summary>
        public static string PresentExpPerLogin
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "PresentExpPerLogin" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "PresentExpPerLogin" , value );
            }
        }

        /// <summary>
        /// 会员每登录一次奖励的点券
        /// </summary>
        public static string AddPointPerLogin
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "AddPointPerLogin" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "AddPointPerLogin" , value );
            }
        }

        /// <summary>
        /// 会员的资金与点券的兑换比率
        /// </summary>
        public static string MoneyExchangePoint
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "MoneyExchangePoint" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "MoneyExchangePoint" , value );
            }
        }

        /// <summary>
        /// 会员的资金与有效期的兑换比率
        /// </summary>
        public static string MoneyExchangeValidDay
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "MoneyExchangeValidDay" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "MoneyExchangeValidDay" , value );
            }
        }

        /// <summary>
        /// 会员的积分与点券的兑换比率
        /// </summary>
        public static string UserExpExchangePoint
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "UserExpExchangePoint" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "UserExpExchangePoint" , value );
            }
        }

        /// <summary>
        /// 会员的积分与有效期的兑换比率
        /// </summary>
        public static string UserExpExchangeValidDay
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "UserExpExchangeValidDay" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "UserExpExchangeValidDay" , value );
            }
        }

        /// <summary>
        /// 点券的名称
        /// </summary>
        public static string PointName
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "PointName" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "PointName" , value );
            }
        }

        /// <summary>
        /// 点券的单位
        /// </summary>
        public static string PointUnit
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UserParams , "PointUnit" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UserParams , "PointUnit" , value );
            }
        }

        public static bool Config( string EnableUserReg , string Protocol , string EnableMultiRegPerEmail , string UserNameLimit
            , string UserNameMax , string UserName_RegDisabled , string RegFields_MustFill , string RegFields_SelectFill , string EnableRegCompany
            , string EnableCheckCodeOfReg , string EnableQAofReg , string RegQuestion1 , string RegAnswer1
            , string RegQuestion2 , string RegAnswer2 , string RegQuestion3 , string RegAnswer3
            , string AdminCheckReg , string EmailCheckReg , string EmailOfRegCheck , string UserGroup
            , string PresentExp , string PresentMoney , string PresentPoint , string PresentValidNum
            , string GetPasswordType , string EnableCheckCodeOfLogin , string EnableMultiLogin , string PresentExpPerLogin
            , string AddPointPerLogin , string MoneyExchangePoint , string MoneyExchangeValidDay , string UserExpExchangePoint
            , string UserExpExchangeValidDay , string PointName , string PointUnit )
        {
            Dictionary<string , string> dicts = new Dictionary<string , string>( );

            dicts.Add( "EnableUserReg" , EnableUserReg );
            dicts.Add( "Protocol" , Protocol );
            dicts.Add( "EnableMultiRegPerEmail" , EnableMultiRegPerEmail );
            dicts.Add( "UserNameLimit" , UserNameLimit );
            dicts.Add( "UserNameMax" , UserNameMax );
            dicts.Add( "UserName_RegDisabled" , UserName_RegDisabled );
            dicts.Add( "RegFields_MustFill" , RegFields_MustFill );
            dicts.Add( "RegFields_SelectFill" , RegFields_SelectFill );
            dicts.Add( "EnableRegCompany" , EnableRegCompany );
            dicts.Add( "EnableCheckCodeOfReg" , EnableCheckCodeOfReg );
            dicts.Add( "EnableQAofReg" , EnableQAofReg );
            dicts.Add( "RegQuestion1" , RegQuestion1 );
            dicts.Add( "RegAnswer1" , RegAnswer1 );
            dicts.Add( "RegQuestion2" , RegQuestion2 );
            dicts.Add( "RegAnswer2" , RegAnswer2 );
            dicts.Add( "RegQuestion3" , RegQuestion3 );
            dicts.Add( "RegAnswer3" , RegAnswer3 );
            dicts.Add( "AdminCheckReg" , AdminCheckReg );
            dicts.Add( "EmailCheckReg" , EmailCheckReg );
            dicts.Add( "EmailOfRegCheck" , EmailOfRegCheck );
            dicts.Add( "UserGroup" , UserGroup );
            dicts.Add( "PresentExp" , PresentExp );
            dicts.Add( "PresentMoney" , PresentMoney );
            dicts.Add( "PresentPoint" , PresentPoint );
            dicts.Add( "PresentValidNum" , PresentValidNum );
            dicts.Add( "GetPasswordType" , GetPasswordType );
            dicts.Add( "EnableCheckCodeOfLogin" , EnableCheckCodeOfLogin );
            dicts.Add( "EnableMultiLogin" , EnableMultiLogin );
            dicts.Add( "PresentExpPerLogin" , PresentExpPerLogin );
            dicts.Add( "AddPointPerLogin" , AddPointPerLogin );
            dicts.Add( "MoneyExchangePoint" , MoneyExchangePoint );
            dicts.Add( "MoneyExchangeValidDay" , MoneyExchangeValidDay );
            dicts.Add( "UserExpExchangePoint" , UserExpExchangePoint );
            dicts.Add( "UserExpExchangeValidDay" , UserExpExchangeValidDay );
            dicts.Add( "PointName" , PointName );
            dicts.Add( "PointUnit" , PointUnit );

            return BaseConfig.SetConfigForBatch( BaseConfig.eConfigs.UserParams , dicts );
        }
        #endregion
    }
}
